<?php include template("header");?>
<div id="bdw" class="bdw">
<div id="bd" class="cf">
<div id="content">
    <form action="/team/buy.php?id=<?php echo $team['id']; ?>" method="post" class="validator">
	<input id="deal-per-number" value="<?php echo $team['per_number']; ?>" type="hidden" />
    <div id="deal-buy" class="box">
        <div class="box-top"></div>
        <div class="box-content">
            <div class="head"><h2>Envie seu pedido<?php if($team['farefree']>0){?>&nbsp;(<span class="currency"><?php echo $team['farefree']; ?></span>livre de taxas)<?php }?></h2></div>
            <div class="sect">
            <table class="order-table">
                <tr>
                    <th class="deal-buy-desc">Oferta</th>
                    <th class="deal-buy-quantity">quantidade</th>
                    <th class="deal-buy-multi"></th>
                    <th class="deal-buy-price">preço</th>
                    <th class="deal-buy-equal"></th>
                    <th class="deal-buy-total">total</th>
                </tr>
                <tr>
                    <td class="deal-buy-desc"><?php echo $team['title']; ?></td>
                    <td class="deal-buy-quantity"><input type="text" class="input-text f-input" maxlength="4" name="quantity" value="<?php echo $order['quantity']; ?>" ff="<?php echo abs(intval($team['farefree'])); ?>" id="deal-buy-quantity-input" <?php echo $team['per_number']==1?'readonly':''; ?> /><br /><span style="font-size:12px;color:gray;"><?php if($team['per_number']==0){?>no total 9999 peças<?php } else { ?>no máximo<?php echo $team['per_number']; ?>pieces<?php }?></span></td>
                    <td class="deal-buy-multi">x</td>
                    <td class="deal-buy-price"><span class="money"><?php echo $currency; ?></span><span id="deal-buy-price"><?php echo $team['team_price']; ?></span></td>
                    <td class="deal-buy-equal">=</td>
                    <td class="deal-buy-total"><span class="money"><?php echo $currency; ?></span><span id="deal-buy-total"><?php echo $order['quantity']*$team['team_price']; ?></span></td>
                </tr>
				<?php if($team['delivery']=='express'){?>
                <tr>
                    <td class="deal-buy-desc">express</td>
                    <td class="deal-buy-quantity"></td>
                    <td class="deal-buy-multi"></td>
                    <td class="deal-buy-price"><span class="money"><?php echo $currency; ?></span><span id="deal-express-price" v="<?php echo $team['fare']; ?>"><?php echo $team['fare']; ?></span></td>
                    <td class="deal-buy-equal">=</td>
                    <td class="deal-buy-total"><span class="money"><?php echo $currency; ?></span><span id="deal-express-total" v="<?php echo $team['fare']; ?>"><?php echo $team['fare']; ?></span></td>
                </tr>
				<?php }?>

				<tr class="order-total">
                    <td class="deal-buy-desc"><strong>Valor total de pedidos?</strong></td>
                    <td class="deal-buy-quantity"></td>
                    <td class="deal-buy-multi"></td>
                    <td class="deal-buy-price"></td>
                    <td class="deal-buy-equal">=</td>
                    <td class="deal-buy-total"><span class="money"><?php echo $currency; ?></span><strong id="deal-buy-total-t"><?php echo $order['origin']; ?></strong></td>
                </tr>
            </table>

			<?php if($team['delivery']=='express'){?>
			<div class="expresstip"><?php echo nl2br(htmlspecialchars($team['express'])); ?></div>
			<div class="wholetip clear"><h3>Informações</h3></div>
			<div class="field username">
				<label>Recibo</label>
				<input type="text" size="30" name="realname" id="settings-realname" class="f-input" value="<?php echo $login_user['realname']; ?>" require="true" datatype="require" />
				<span class="hint">Nome do que irá constar no copum deverá ser igual a carteira de identidade para que a entrega seja feita.</span>
			</div>
			<div class="field mobile">
				<label>Celular</label>
				<input type="text" size="30" name="mobile" id="settings-mobile" class="number" value="<?php echo $login_user['mobile']; ?>" require="true" datatype="mobile" maxLength="11" /> <span class="inputtip">Seu celular é o meio mais importante para nós contactá-lo, por favor, introduza o número corretamente</span>
			</div>
				<div class="field username">
				<label>Endereço</label>
				<input type="text" size="30" name="address" id="settings-address" class="f-input" value="<?php echo $login_user['address']; ?>" require="true" datatype="require" />
				<span class="hint">Para uma entrega, por favor insira seu endereço</span>
			</div>
			<div class="field mobile">
				<label>CEP</label>
				<input type="text" size="30" name="zipcode" id="settings-mobile" class="number" value="<?php echo $login_user['zipcode']; ?>" require="true" datatype="zip" maxLength="6" />
			</div>
			<?php } else { ?>
			<div class="field mobile">
				<label>celular</label>
				<input type="text" size="30" name="mobile" id="settings-mobile" class="number" value="<?php echo $login_user['mobile']; ?>"  datatype="mobile" maxLength="11" /><span class="inputtip">Por favor coloque um número correto (você pode comprar para seu amigo)</span>
			</div>
			<?php }?>
			<div class="wholetip clear"><h3>Informações adicionais</h3></div>
			<?php if($condbuy=nanooption($team['condbuy'])){?>
			<div class="field mobile">
				<label><?php echo $team['condbuy_titulo']; ?></label>
				<select name="condbuy" class="f-input" style="width:auto;"><?php echo Utility::Option(array_combine($condbuy, $condbuy), 'condbuy'); ?></select>
			</div>
			<?php }?>
			<div class="field mobile">
				<label>informação pedido</label>
				<textarea name="remark" style="width:500px;height:80px;padding:2px;"><?php echo htmlspecialchars($order['remark']); ?></textarea>
			</div>
            <input type="hidden" name="id" value="<?php echo $order['id']; ?>" />
			<div class="form-submit"><input type="submit" class="formbutton" name="buy" value="Confirmado"/></div>
            </div>
        </div>
        <div class="box-bottom"></div>
    </div>
    </form>
</div>
<div id="sidebar">
	<?php include template("block_side_credit");?>
</div>
</div> <!-- bd end -->
</div> <!-- bdw end -->
<?php include template("footer");?>
